** construction regressions using place-level annual data

set trace off
set more 1 
capture log close
clear
clear matrix
clear mata
set matsize 11000
set maxvar 32767
set linesize 200
version 9

log using table3.log, replace

use placeann.dta if sfus~=., clear
drop if dlrgasp1at==. | husf80==.
drop if cbsa==.
drop if micro==1
egen nobs = count(sfus), by(newid)

tab year, gen(y)
tab year if nobs==28
egen msayear = group(cbsa year)
reg sfus dlrgasp1t24up dlrgasp2t24up dlrgasp3t24up dlrgasp4t24up dlrgasp1d dlrgasp2d dlrgasp3d dlrgasp4d dlfrm1t24up dlfrm2t24up dlfrm3t24up dlfrm4t24up  dlgdp1t24up dlgdp2t24up dlgdp3t24up dlgdp4t24up [w=husf80]
keep if e(sample)
keep sfus dlrgasp1t24up dlrgasp2t24up dlrgasp3t24up dlrgasp4t24up dlrgasp1d dlrgasp2d dlrgasp3d dlrgasp4d dlfrm1t24up dlfrm2t24up dlfrm3t24up dlfrm4t24up  dlgdp1t24up dlgdp2t24up dlgdp3t24up dlgdp4t24up husf80 cbsa newid msayear year carworks80 dtime

xi: areg sfus dlrgasp1t24up dlrgasp2t24up dlrgasp3t24up dlrgasp4t24up dlrgasp1d dlrgasp2d dlrgasp3d dlrgasp4d dlfrm1t24up dlfrm2t24up dlfrm3t24up dlfrm4t24up  dlgdp1t24up dlgdp2t24up dlgdp3t24up dlgdp4t24up  i.newid if carworks80>=.9 & carworks80~=. [w=husf80], cluster(cbsa) absorb(msayear)
lincom dlrgasp1t24up+dlrgasp2t24up+dlrgasp3t24up+dlrgasp4t24up
lincom dlrgasp1d+dlrgasp2d+dlrgasp3d+dlrgasp4d
lincom dlfrm1t24up+dlfrm2t24up+dlfrm3t24up+dlfrm4t24up
lincom dlgdp1t24up+dlgdp2t24up+dlgdp3t24up+dlgdp4t24up

xi: areg sfus dlrgasp1t24up dlrgasp2t24up dlrgasp3t24up dlrgasp4t24up dlrgasp1d dlrgasp2d dlrgasp3d dlrgasp4d dlfrm1t24up dlfrm2t24up dlfrm3t24up dlfrm4t24up  dlgdp1t24up dlgdp2t24up dlgdp3t24up dlgdp4t24up  i.newid if carworks80<.9 [w=husf80], cluster(cbsa) absorb(msayear)
lincom dlrgasp1t24up+dlrgasp2t24up+dlrgasp3t24up+dlrgasp4t24up
lincom dlrgasp1d+dlrgasp2d+dlrgasp3d+dlrgasp4d
lincom dlfrm1t24up+dlfrm2t24up+dlfrm3t24up+dlfrm4t24up
lincom dlgdp1t24up+dlgdp2t24up+dlgdp3t24up+dlgdp4t24up


* dtime = max(commute time) of cbsa - min(commute time) of cbsa
egen markm = tag(cbsa) if dtime~=.
sum dtime if markm==1, det
gen p75dtime = r(p75)
xi: areg sfus dlrgasp1t24up dlrgasp2t24up dlrgasp3t24up dlrgasp4t24up dlrgasp1d dlrgasp2d dlrgasp3d dlrgasp4d dlfrm1t24up dlfrm2t24up dlfrm3t24up dlfrm4t24up  dlgdp1t24up dlgdp2t24up dlgdp3t24up dlgdp4t24up  i.newid if dtime>p75dtime & dtime~=. [w=husf80], cluster(cbsa) absorb(msayear)
lincom dlrgasp1t24up+dlrgasp2t24up+dlrgasp3t24up+dlrgasp4t24up
lincom dlrgasp1d+dlrgasp2d+dlrgasp3d+dlrgasp4d
lincom dlfrm1t24up+dlfrm2t24up+dlfrm3t24up+dlfrm4t24up
lincom dlgdp1t24up+dlgdp2t24up+dlgdp3t24up+dlgdp4t24up

xi: areg sfus dlrgasp1t24up dlrgasp2t24up dlrgasp3t24up dlrgasp4t24up dlrgasp1d dlrgasp2d dlrgasp3d dlrgasp4d dlfrm1t24up dlfrm2t24up dlfrm3t24up dlfrm4t24up  dlgdp1t24up dlgdp2t24up dlgdp3t24up dlgdp4t24up  i.newid if dtime<=p75dtime [w=husf80], cluster(cbsa) absorb(msayear)
lincom dlrgasp1t24up+dlrgasp2t24up+dlrgasp3t24up+dlrgasp4t24up
lincom dlrgasp1d+dlrgasp2d+dlrgasp3d+dlrgasp4d
lincom dlfrm1t24up+dlfrm2t24up+dlfrm3t24up+dlfrm4t24up
lincom dlgdp1t24up+dlgdp2t24up+dlgdp3t24up+dlgdp4t24up


quietly log off
quietly log close
set more 0
